package com.ssyan.appointment.hosp.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.ssyan.appointment.common.result.Result;
import com.ssyan.appointment.hosp.service.DepartmentService;
import com.ssyan.appointment.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ssyan
 * @Description TODO
 * @create 2021/9/20 1:34
 * @Version 1.0
 */
@Api(tags = "科室管理")
@RestController
@RequestMapping("/admin/hosp/department")
@CrossOrigin
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    //根据医院的编号，查询医院所有科室的列表
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("/getDeptList/{hoscode}")
    public Result getDeptList(@ApiParam(name = "hoscode", value = "医院编号")
                              @PathVariable String hoscode){
        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);
        return Result.ok(list);
    }
}
